#ifndef _BINARY_SEARCH_TREE_H_
#define _BINARY_SEARCH_TREE_H_
#define KEY_LENGTH 100
/* Type definitions */
typedef char Key[KEY_LENGTH];
typedef struct node
{
Key key;
struct node *parent;
struct node *leftchild;
struct node *rightchild;
} Node;
typedef Node * Tree;
/* Function prototypes */
void key_setequal(Key a, Key b);
int key_isequal(Key a, Key b);
int key_lessthan(Key a, Key b);
void tree_init(Tree *t);
Node *tree_makenode(Key k, Node *parent);
Node *tree_root(Tree t);
Node *tree_parent(Node *n, Tree t);
Node *tree_leftchild(Node *n, Tree t);
Node *tree_rightchild(Node *n, Tree t);
Node *tree_search(Key k, Tree t);
int tree_num_children(Node *n);
void tree_insert(Tree *t, Key k);
void tree_delete(Tree t, Key k);
void tree_preorder(Node *n, FILE *fp);
void tree_postorder(Node *n, FILE *fp);
void tree_inorder(Node *n, FILE *fp);
int tree_empty(Tree t);
int tree_height(Tree t);
/* void tree_makenull(Tree t); */
void tree_makenull(Tree *t);
#endif
